{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T06:56:27.668267Z",
     "start_time": "2018-12-19T06:56:27.036379Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'0.20.1'"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import sklearn\n",
    "import warnings\n",
    "warnings.filterwarnings('ignore')\n",
    "sklearn.__version__"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T06:53:06.364515Z",
     "start_time": "2018-12-19T06:53:06.243907Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[31mdata_description.txt\u001b[m\u001b[m     \u001b[31msample_submission.csv\u001b[m\u001b[m    \u001b[31mtrain.csv\u001b[m\u001b[m\r\n",
      "kaggle_house_price.ipynb \u001b[31mtest.csv\u001b[m\u001b[m\r\n"
     ]
    }
   ],
   "source": [
    "!ls"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T06:53:21.347721Z",
     "start_time": "2018-12-19T06:53:21.323381Z"
    }
   },
   "outputs": [],
   "source": [
    "df = pd.read_csv('train.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T06:53:34.232934Z",
     "start_time": "2018-12-19T06:53:34.227402Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['Id', 'MSSubClass', 'MSZoning', 'LotFrontage', 'LotArea', 'Street',\n",
       "       'Alley', 'LotShape', 'LandContour', 'Utilities', 'LotConfig',\n",
       "       'LandSlope', 'Neighborhood', 'Condition1', 'Condition2', 'BldgType',\n",
       "       'HouseStyle', 'OverallQual', 'OverallCond', 'YearBuilt', 'YearRemodAdd',\n",
       "       'RoofStyle', 'RoofMatl', 'Exterior1st', 'Exterior2nd', 'MasVnrType',\n",
       "       'MasVnrArea', 'ExterQual', 'ExterCond', 'Foundation', 'BsmtQual',\n",
       "       'BsmtCond', 'BsmtExposure', 'BsmtFinType1', 'BsmtFinSF1',\n",
       "       'BsmtFinType2', 'BsmtFinSF2', 'BsmtUnfSF', 'TotalBsmtSF', 'Heating',\n",
       "       'HeatingQC', 'CentralAir', 'Electrical', '1stFlrSF', '2ndFlrSF',\n",
       "       'LowQualFinSF', 'GrLivArea', 'BsmtFullBath', 'BsmtHalfBath', 'FullBath',\n",
       "       'HalfBath', 'BedroomAbvGr', 'KitchenAbvGr', 'KitchenQual',\n",
       "       'TotRmsAbvGrd', 'Functional', 'Fireplaces', 'FireplaceQu', 'GarageType',\n",
       "       'GarageYrBlt', 'GarageFinish', 'GarageCars', 'GarageArea', 'GarageQual',\n",
       "       'GarageCond', 'PavedDrive', 'WoodDeckSF', 'OpenPorchSF',\n",
       "       'EnclosedPorch', '3SsnPorch', 'ScreenPorch', 'PoolArea', 'PoolQC',\n",
       "       'Fence', 'MiscFeature', 'MiscVal', 'MoSold', 'YrSold', 'SaleType',\n",
       "       'SaleCondition', 'SalePrice'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Feature extraction"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T06:53:55.600856Z",
     "start_time": "2018-12-19T06:53:55.561895Z"
    }
   },
   "outputs": [],
   "source": [
    "df = pd.get_dummies(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T06:54:00.782627Z",
     "start_time": "2018-12-19T06:54:00.756824Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Id</th>\n",
       "      <th>MSSubClass</th>\n",
       "      <th>LotFrontage</th>\n",
       "      <th>LotArea</th>\n",
       "      <th>OverallQual</th>\n",
       "      <th>OverallCond</th>\n",
       "      <th>YearBuilt</th>\n",
       "      <th>YearRemodAdd</th>\n",
       "      <th>MasVnrArea</th>\n",
       "      <th>BsmtFinSF1</th>\n",
       "      <th>...</th>\n",
       "      <th>SaleType_ConLw</th>\n",
       "      <th>SaleType_New</th>\n",
       "      <th>SaleType_Oth</th>\n",
       "      <th>SaleType_WD</th>\n",
       "      <th>SaleCondition_Abnorml</th>\n",
       "      <th>SaleCondition_AdjLand</th>\n",
       "      <th>SaleCondition_Alloca</th>\n",
       "      <th>SaleCondition_Family</th>\n",
       "      <th>SaleCondition_Normal</th>\n",
       "      <th>SaleCondition_Partial</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>60</td>\n",
       "      <td>65.0</td>\n",
       "      <td>8450</td>\n",
       "      <td>7</td>\n",
       "      <td>5</td>\n",
       "      <td>2003</td>\n",
       "      <td>2003</td>\n",
       "      <td>196.0</td>\n",
       "      <td>706</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>20</td>\n",
       "      <td>80.0</td>\n",
       "      <td>9600</td>\n",
       "      <td>6</td>\n",
       "      <td>8</td>\n",
       "      <td>1976</td>\n",
       "      <td>1976</td>\n",
       "      <td>0.0</td>\n",
       "      <td>978</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>60</td>\n",
       "      <td>68.0</td>\n",
       "      <td>11250</td>\n",
       "      <td>7</td>\n",
       "      <td>5</td>\n",
       "      <td>2001</td>\n",
       "      <td>2002</td>\n",
       "      <td>162.0</td>\n",
       "      <td>486</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>70</td>\n",
       "      <td>60.0</td>\n",
       "      <td>9550</td>\n",
       "      <td>7</td>\n",
       "      <td>5</td>\n",
       "      <td>1915</td>\n",
       "      <td>1970</td>\n",
       "      <td>0.0</td>\n",
       "      <td>216</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>60</td>\n",
       "      <td>84.0</td>\n",
       "      <td>14260</td>\n",
       "      <td>8</td>\n",
       "      <td>5</td>\n",
       "      <td>2000</td>\n",
       "      <td>2000</td>\n",
       "      <td>350.0</td>\n",
       "      <td>655</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 290 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   Id  MSSubClass  LotFrontage  LotArea  OverallQual  OverallCond  YearBuilt  \\\n",
       "0   1          60         65.0     8450            7            5       2003   \n",
       "1   2          20         80.0     9600            6            8       1976   \n",
       "2   3          60         68.0    11250            7            5       2001   \n",
       "3   4          70         60.0     9550            7            5       1915   \n",
       "4   5          60         84.0    14260            8            5       2000   \n",
       "\n",
       "   YearRemodAdd  MasVnrArea  BsmtFinSF1          ...            \\\n",
       "0          2003       196.0         706          ...             \n",
       "1          1976         0.0         978          ...             \n",
       "2          2002       162.0         486          ...             \n",
       "3          1970         0.0         216          ...             \n",
       "4          2000       350.0         655          ...             \n",
       "\n",
       "   SaleType_ConLw  SaleType_New  SaleType_Oth  SaleType_WD  \\\n",
       "0             0.0           0.0           0.0          1.0   \n",
       "1             0.0           0.0           0.0          1.0   \n",
       "2             0.0           0.0           0.0          1.0   \n",
       "3             0.0           0.0           0.0          1.0   \n",
       "4             0.0           0.0           0.0          1.0   \n",
       "\n",
       "   SaleCondition_Abnorml  SaleCondition_AdjLand  SaleCondition_Alloca  \\\n",
       "0                    0.0                    0.0                   0.0   \n",
       "1                    0.0                    0.0                   0.0   \n",
       "2                    0.0                    0.0                   0.0   \n",
       "3                    1.0                    0.0                   0.0   \n",
       "4                    0.0                    0.0                   0.0   \n",
       "\n",
       "   SaleCondition_Family  SaleCondition_Normal  SaleCondition_Partial  \n",
       "0                   0.0                   1.0                    0.0  \n",
       "1                   0.0                   1.0                    0.0  \n",
       "2                   0.0                   1.0                    0.0  \n",
       "3                   0.0                   0.0                    0.0  \n",
       "4                   0.0                   1.0                    0.0  \n",
       "\n",
       "[5 rows x 290 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T06:55:40.746879Z",
     "start_time": "2018-12-19T06:55:40.462492Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/datalab/Applications/anaconda/lib/python3.5/site-packages/numpy/lib/function_base.py:3834: RuntimeWarning: Invalid value encountered in percentile\n",
      "  RuntimeWarning)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Id</th>\n",
       "      <th>MSSubClass</th>\n",
       "      <th>LotFrontage</th>\n",
       "      <th>LotArea</th>\n",
       "      <th>OverallQual</th>\n",
       "      <th>OverallCond</th>\n",
       "      <th>YearBuilt</th>\n",
       "      <th>YearRemodAdd</th>\n",
       "      <th>MasVnrArea</th>\n",
       "      <th>BsmtFinSF1</th>\n",
       "      <th>...</th>\n",
       "      <th>SaleType_ConLw</th>\n",
       "      <th>SaleType_New</th>\n",
       "      <th>SaleType_Oth</th>\n",
       "      <th>SaleType_WD</th>\n",
       "      <th>SaleCondition_Abnorml</th>\n",
       "      <th>SaleCondition_AdjLand</th>\n",
       "      <th>SaleCondition_Alloca</th>\n",
       "      <th>SaleCondition_Family</th>\n",
       "      <th>SaleCondition_Normal</th>\n",
       "      <th>SaleCondition_Partial</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>1460.000000</td>\n",
       "      <td>1460.000000</td>\n",
       "      <td>1201.000000</td>\n",
       "      <td>1460.000000</td>\n",
       "      <td>1460.000000</td>\n",
       "      <td>1460.000000</td>\n",
       "      <td>1460.000000</td>\n",
       "      <td>1460.000000</td>\n",
       "      <td>1452.000000</td>\n",
       "      <td>1460.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>1460.000000</td>\n",
       "      <td>1460.000000</td>\n",
       "      <td>1460.000000</td>\n",
       "      <td>1460.000000</td>\n",
       "      <td>1460.000000</td>\n",
       "      <td>1460.000000</td>\n",
       "      <td>1460.000000</td>\n",
       "      <td>1460.000000</td>\n",
       "      <td>1460.000000</td>\n",
       "      <td>1460.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>730.500000</td>\n",
       "      <td>56.897260</td>\n",
       "      <td>70.049958</td>\n",
       "      <td>10516.828082</td>\n",
       "      <td>6.099315</td>\n",
       "      <td>5.575342</td>\n",
       "      <td>1971.267808</td>\n",
       "      <td>1984.865753</td>\n",
       "      <td>103.685262</td>\n",
       "      <td>443.639726</td>\n",
       "      <td>...</td>\n",
       "      <td>0.003425</td>\n",
       "      <td>0.083562</td>\n",
       "      <td>0.002055</td>\n",
       "      <td>0.867808</td>\n",
       "      <td>0.069178</td>\n",
       "      <td>0.002740</td>\n",
       "      <td>0.008219</td>\n",
       "      <td>0.013699</td>\n",
       "      <td>0.820548</td>\n",
       "      <td>0.085616</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>421.610009</td>\n",
       "      <td>42.300571</td>\n",
       "      <td>24.284752</td>\n",
       "      <td>9981.264932</td>\n",
       "      <td>1.382997</td>\n",
       "      <td>1.112799</td>\n",
       "      <td>30.202904</td>\n",
       "      <td>20.645407</td>\n",
       "      <td>181.066207</td>\n",
       "      <td>456.098091</td>\n",
       "      <td>...</td>\n",
       "      <td>0.058440</td>\n",
       "      <td>0.276824</td>\n",
       "      <td>0.045299</td>\n",
       "      <td>0.338815</td>\n",
       "      <td>0.253844</td>\n",
       "      <td>0.052289</td>\n",
       "      <td>0.090317</td>\n",
       "      <td>0.116277</td>\n",
       "      <td>0.383862</td>\n",
       "      <td>0.279893</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>21.000000</td>\n",
       "      <td>1300.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1872.000000</td>\n",
       "      <td>1950.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>365.750000</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>7553.500000</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1954.000000</td>\n",
       "      <td>1967.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>730.500000</td>\n",
       "      <td>50.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>9478.500000</td>\n",
       "      <td>6.000000</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>1973.000000</td>\n",
       "      <td>1994.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>383.500000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>1095.250000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>11601.500000</td>\n",
       "      <td>7.000000</td>\n",
       "      <td>6.000000</td>\n",
       "      <td>2000.000000</td>\n",
       "      <td>2004.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>712.250000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>1460.000000</td>\n",
       "      <td>190.000000</td>\n",
       "      <td>313.000000</td>\n",
       "      <td>215245.000000</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>9.000000</td>\n",
       "      <td>2010.000000</td>\n",
       "      <td>2010.000000</td>\n",
       "      <td>1600.000000</td>\n",
       "      <td>5644.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8 rows × 290 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                Id   MSSubClass  LotFrontage        LotArea  OverallQual  \\\n",
       "count  1460.000000  1460.000000  1201.000000    1460.000000  1460.000000   \n",
       "mean    730.500000    56.897260    70.049958   10516.828082     6.099315   \n",
       "std     421.610009    42.300571    24.284752    9981.264932     1.382997   \n",
       "min       1.000000    20.000000    21.000000    1300.000000     1.000000   \n",
       "25%     365.750000    20.000000          NaN    7553.500000     5.000000   \n",
       "50%     730.500000    50.000000          NaN    9478.500000     6.000000   \n",
       "75%    1095.250000    70.000000          NaN   11601.500000     7.000000   \n",
       "max    1460.000000   190.000000   313.000000  215245.000000    10.000000   \n",
       "\n",
       "       OverallCond    YearBuilt  YearRemodAdd   MasVnrArea   BsmtFinSF1  \\\n",
       "count  1460.000000  1460.000000   1460.000000  1452.000000  1460.000000   \n",
       "mean      5.575342  1971.267808   1984.865753   103.685262   443.639726   \n",
       "std       1.112799    30.202904     20.645407   181.066207   456.098091   \n",
       "min       1.000000  1872.000000   1950.000000     0.000000     0.000000   \n",
       "25%       5.000000  1954.000000   1967.000000          NaN     0.000000   \n",
       "50%       5.000000  1973.000000   1994.000000          NaN   383.500000   \n",
       "75%       6.000000  2000.000000   2004.000000          NaN   712.250000   \n",
       "max       9.000000  2010.000000   2010.000000  1600.000000  5644.000000   \n",
       "\n",
       "               ...            SaleType_ConLw  SaleType_New  SaleType_Oth  \\\n",
       "count          ...               1460.000000   1460.000000   1460.000000   \n",
       "mean           ...                  0.003425      0.083562      0.002055   \n",
       "std            ...                  0.058440      0.276824      0.045299   \n",
       "min            ...                  0.000000      0.000000      0.000000   \n",
       "25%            ...                  0.000000      0.000000      0.000000   \n",
       "50%            ...                  0.000000      0.000000      0.000000   \n",
       "75%            ...                  0.000000      0.000000      0.000000   \n",
       "max            ...                  1.000000      1.000000      1.000000   \n",
       "\n",
       "       SaleType_WD  SaleCondition_Abnorml  SaleCondition_AdjLand  \\\n",
       "count  1460.000000            1460.000000            1460.000000   \n",
       "mean      0.867808               0.069178               0.002740   \n",
       "std       0.338815               0.253844               0.052289   \n",
       "min       0.000000               0.000000               0.000000   \n",
       "25%       1.000000               0.000000               0.000000   \n",
       "50%       1.000000               0.000000               0.000000   \n",
       "75%       1.000000               0.000000               0.000000   \n",
       "max       1.000000               1.000000               1.000000   \n",
       "\n",
       "       SaleCondition_Alloca  SaleCondition_Family  SaleCondition_Normal  \\\n",
       "count           1460.000000           1460.000000           1460.000000   \n",
       "mean               0.008219              0.013699              0.820548   \n",
       "std                0.090317              0.116277              0.383862   \n",
       "min                0.000000              0.000000              0.000000   \n",
       "25%                0.000000              0.000000              1.000000   \n",
       "50%                0.000000              0.000000              1.000000   \n",
       "75%                0.000000              0.000000              1.000000   \n",
       "max                1.000000              1.000000              1.000000   \n",
       "\n",
       "       SaleCondition_Partial  \n",
       "count            1460.000000  \n",
       "mean                0.085616  \n",
       "std                 0.279893  \n",
       "min                 0.000000  \n",
       "25%                 0.000000  \n",
       "50%                 0.000000  \n",
       "75%                 0.000000  \n",
       "max                 1.000000  \n",
       "\n",
       "[8 rows x 290 columns]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T06:57:34.554784Z",
     "start_time": "2018-12-19T06:57:34.091846Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZEAAAEXCAYAAABsyHmSAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAA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aP3ZnaaRU1YW9X4hHAc+lOTt5Ls0vyOOSnAu8unp/PSU5HPhd4DnAo2hGck21Bvgms3si8EjgFuDNSWZqs4um62wmf7S7dJoRZZ8HPlpVfzVD23+YKUDm8OzeceftkqP5+u8BTkhywgz79wb2S7JPVX1vhv0aU4aIRk5V3QN8uvfYPfT314GzaYbCfgL4ZJJfAy6iuX7xGeDrwA9pupKOBI4AHjLPx+3Tez6Y+wNhJg+fpdYZU2cW327RFmA18P2q2rWAtvvQ/D6Y62uA5uswRPRThohGXlXdC1yY5GnAm4GjaS4yv4OmG2qiqm6a+p4kH6EJkfnsHgX2iao6fumqnlHbvucdwD5JVi4gSHYCe1XVI7uVpnHlEF+Nk3/uPe/+638dcOMMAbIXTRfYQnyN5pf1s3ujtIbJNTRf6zELbPuIJD/f35I0agwRjYwkJyd54UzzMpI8Bjit9/LK3vNW4OAkj5vSLjSjrZ6ykM/sXUg/C3gscGaSlTN89mOTLOh4S+ys3vO7k6yZvnPatvf0nv/H1O/HlLYPS/LsPtSoZc7uLI2Sw2gukn87yRdoRjQBHASsp5lXcTHNdRBofnF+GPhyko/TXFg+nCZANgMbFvi57wB+AXgtsCHJFmA7zYX6g3vHfBNw42K+uLaq6tNJ/gtNF95NSXbPE3k0zZnWNTTDd6mqzybZCPwxcEuSy2i+fw8HHk/TtfcFFnZWozFiiGiUvJtmlNQLaCbJvRh4KM2F4CtoJgGet3tkVlV9JMmPgd8D/i3NKKrPA6+huRC/oBCpqnuSHEczee/VNMNqH04z9PcbwFtoJgfucVX1liRXA6/r1fUwmkmE1wHnTmv7J0mu6rV9Ls06XjtpAnETzfdPegDniUiSOvOaiCSpM0NEktSZISJJ6swQkSR1ZohIkjozRCRJnRkikqTODBFJUmeGiCSpM0NEktTZ/wd3HMGluV4B5AAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.hist(df['SalePrice'], bins = 50, histtype = 'step')\n",
    "plt.xscale('log')\n",
    "plt.yscale('log')\n",
    "plt.xlabel('SalePrice', fontsize = 20)\n",
    "plt.ylabel('frequency', fontsize = 20)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T08:15:47.105958Z",
     "start_time": "2018-12-19T08:15:47.029473Z"
    }
   },
   "outputs": [],
   "source": [
    "df = df.fillna(df.mean())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T08:15:49.206816Z",
     "start_time": "2018-12-19T08:15:49.200093Z"
    }
   },
   "outputs": [],
   "source": [
    "X = df.drop(['SalePrice', 'Id'], axis = 1)\n",
    "y = df['SalePrice']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T08:15:49.859850Z",
     "start_time": "2018-12-19T08:15:49.849446Z"
    }
   },
   "outputs": [],
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    "Xtrain, Xtest, ytrain, ytest = train_test_split(X, y, random_state=1, train_size = 0.8)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Naive Bayes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T08:15:51.493706Z",
     "start_time": "2018-12-19T08:15:51.242386Z"
    }
   },
   "outputs": [],
   "source": [
    "from sklearn.naive_bayes import GaussianNB\n",
    "# Classifiers need integer or string labels.\n",
    "model = GaussianNB()\n",
    "model.fit(Xtrain, ytrain.astype(int))\n",
    "y_model = model.predict(Xtest)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T08:16:31.974068Z",
     "start_time": "2018-12-19T08:16:31.435569Z"
    }
   },
   "outputs": [
    {
     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f7GM455Lsv1s7LkjxXvxrIw9P5DmnK1xx043BiGWjUREVDXOudNm9hiAj5jZdgDdYJzhq865t5dx6DVJtq+NPY8lGk6Sz/h9b3TOvZzBuf3+6cYgxLJRTEQI4L/Hnj8LWiEAM6qWw81m1pZg+x2x5xezONbzsed3Z7i/P/Y/MLPaFGMQYtlIRIQAvgfgMBir+GUAbzjnktaPZEgHGGv5OWY2AOCToKXwjSyO9RcARgF83szeEf+mmdWY2R3+tXPuFIDvgmnGvxa374eheIiIELmzRNXjnHNm9kUAfxDb9GAEh30WwD83sz0AfoygTqQGwGedc+NZjO+Cmf0SKDzPm9n3ALwKur96wcD7SgBNoY/9H2CdyB/GChxfAutEPgLWmdy7vMsTgsgSEYI8BNZpXMKVWVO5cBzAbWB9x78ALZwXAPyiS1xomBLn3PcA3AC63jbHjvnPwPjN9wF8PG7/QQC3AvgagHcB+BwoOP8QLFoUIhIs9wxGISqHmDvoaQD/0zn3q8s4zmZQQL7inLs/irEJUcrIEhGC/Gbs+U9S7iWEWIJiIqJqMbPrAXwIwG4AHwDwd865vcUdlRDlhUREVDO7AfwegHEAjwD4V/E7xNxT92d4vD+MaFxClA2KiQiRglCsJBO2OOfezN9ohCg9JCJCCCFyRoF1IYQQOSMREUIIkTMSESGEEDkjERFCCJEzEhEhhBA5IxERQgiRM/8bzHQ3kDdHnDMAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(y_model, ytest, 'ro', alpha = 0.2)\n",
    "plt.xscale('log')\n",
    "plt.yscale('log')\n",
    "plt.xlabel('y_pred', fontsize = 20)\n",
    "plt.ylabel('y_test', fontsize = 20)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T15:27:47.994748Z",
     "start_time": "2018-12-19T15:27:47.980237Z"
    }
   },
   "outputs": [],
   "source": [
    "from sklearn.metrics import mean_squared_error, r2_score, explained_variance_score, roc_auc_score\n",
    "from sklearn.model_selection import cross_val_score\n",
    "\n",
    "def rmsel(y_true,y_pre):\n",
    "    return mean_squared_error(y_true,y_pre)**0.5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T08:20:37.137738Z",
     "start_time": "2018-12-19T08:20:37.128911Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RMSE: 55301.7450573\n",
      "R2 score: 0.571\n",
      "Variance score: 0.580\n"
     ]
    }
   ],
   "source": [
    "y_model = y_model.astype('int')\n",
    "ytest = ytest.astype('int')\n",
    "# model evaluation\n",
    "# https://scikit-learn.org/stable/modules/model_evaluation.html#scoring-parameter\n",
    "rmse = rmsel(ytest, y_model)\n",
    "print('RMSE:', rmse)\n",
    "# Explained variance score: 1 is perfect prediction\n",
    "print('R2 score: %.3f' % r2_score(ytest, y_model))\n",
    "print('Variance score: %.3f' % explained_variance_score(ytest, y_model))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T08:20:11.017695Z",
     "start_time": "2018-12-19T08:20:09.811115Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.56477106747111616"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def r2_cv(model):\n",
    "    r2= cross_val_score(model, X, y, scoring=\"r2\", cv = 5)\n",
    "    return r2\n",
    "\n",
    "np.mean(r2_cv(model))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T08:21:34.822387Z",
     "start_time": "2018-12-19T08:21:33.649387Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.5740418611970538"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def r2_cv(model):\n",
    "    r2= cross_val_score(model, X, y, scoring=\"explained_variance\", cv = 5)\n",
    "    return r2\n",
    "\n",
    "np.mean(r2_cv(model))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Random Forest"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T08:22:19.792015Z",
     "start_time": "2018-12-19T08:22:15.335730Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RandomForestRegressor(bootstrap=True, criterion='mse', max_depth=None,\n",
       "           max_features='auto', max_leaf_nodes=None,\n",
       "           min_impurity_decrease=0.0, min_impurity_split=None,\n",
       "           min_samples_leaf=1, min_samples_split=2,\n",
       "           min_weight_fraction_leaf=0.0, n_estimators=200, n_jobs=None,\n",
       "           oob_score=False, random_state=None, verbose=0, warm_start=False)"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.ensemble import RandomForestRegressor\n",
    "forest = RandomForestRegressor(n_estimators = 200)\n",
    "forest.fit(Xtrain, ytrain)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T08:22:32.076500Z",
     "start_time": "2018-12-19T08:22:32.050764Z"
    }
   },
   "outputs": [],
   "source": [
    "y_pred = forest.predict(Xtest)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T08:22:50.243899Z",
     "start_time": "2018-12-19T08:22:49.801788Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZEAAAEYCAYAAACdnstHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYi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eOAPit8AHn3D4AXwfQBuDDce75a+fc38c5/kvRez7rgv3r/ZhHAHwRwA4z2xad/0ZwN8DTiNme2Dn31wB+kM0HEiIecmeJisU5t2BmXwTwHwD8HIA/i576BIAGAI8557LdK+FF59xknOPfB/AIgB0AvhJz7qcJxron+vN2M/vNOOdviv68BdwSekf0/fPOucUEc3hHgmcJkRESEVHpPAbgNwD8CgIR+RSAqwD+ZBnjXkpw/GL0Z2uSc7F0Rn9+MsUzm2PGTjUHIZaNRERUNM6582b2BIAPm9nNADrAOMNfOOeGljH02gTH10V/RuJNJ8E9/trbnXOH0ni2vz7VHIRYNoqJCAH8UfTnr4BWCMCMquVwh5m1xDl+f/TngQzG+kn059vTvN6P/TYzq04yByGWjURECOBpAMfBWMXPA3jVOZewfiRNWsFYyxuY2S4AHwcthb/KYKw/ATAO4LNmdlfsSTOrMrP7/Xvn3DkAT4Fpxr8ac+0HoXiIyCFyZ4mKxznnzOwLAH43euixHAz7LIBfNrPdAH6IoE6kCsCvOOcmMpjfiJl9FBSen5jZ0wCOgu6vHjDw3glgVei2/xusE/l8tMDxIFgn8mGwzuSh5X08IYgsESHIl8E6jTlcnzWVDacB3AvWd/wT0MJ5EcD7XPxCw6Q4554GcBvoeuuNjvmPwfjN9wB8LOb6AQB3A/hLAG8F8GlQcD4EFi0KkRMs+wxGIcqHqDvoGQBfc859Yhnj9IIC8hXn3KO5mJsQxYwsESHIv47+/IOkVwkhlqCYiKhYzOxWAB8AsBPAzwL4tnPuhcLOSojSQiIiKpmdAH4bwASAbwL4v2IviLqnHk1zvM/naF5ClAyKiQiRhFCsJB22OOdey99shCg+JCJCCCGyRoF1IYQQWSMREUIIkTUSESGEEFkjERFCCJE1EhEhhBBZIxERQgiRNf8bR1WvxBJ8zrIAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(y_pred, ytest, 'ro', alpha = 0.2)\n",
    "plt.xscale('log')\n",
    "plt.yscale('log')\n",
    "plt.xlabel('y_pred', fontsize = 20)\n",
    "plt.ylabel('y_test', fontsize = 20)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-30T04:42:49.202470Z",
     "start_time": "2018-12-30T04:42:48.660013Z"
    }
   },
   "outputs": [],
   "source": [
    "from sklearn.metrics import mean_squared_error, r2_score, explained_variance_score, roc_auc_score\n",
    "from sklearn.model_selection import cross_val_score\n",
    "\n",
    "def rmse(y_true,y_pre):\n",
    "    return mean_squared_error(y_true,y_pre)**0.5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T08:23:42.819831Z",
     "start_time": "2018-12-19T08:23:42.812868Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RMSE: 29553.4130396\n",
      "R2 score: 0.878\n",
      "Variance score: 0.878\n"
     ]
    }
   ],
   "source": [
    "rmse = rmsel(ytest, y_pred)\n",
    "print('RMSE:', rmse)\n",
    "print('R2 score: %.3f' % r2_score(ytest, y_pred))\n",
    "print('Variance score: %.3f' % explained_variance_score(ytest, y_pred))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T08:26:15.668919Z",
     "start_time": "2018-12-19T08:25:54.438055Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.85339663069809579"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def r2_cv(model):\n",
    "    r2= cross_val_score(model, X, y, scoring=\"r2\", cv = 5)\n",
    "    return r2\n",
    "\n",
    "np.mean(r2_cv(forest))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-12-19T08:27:21.462066Z",
     "start_time": "2018-12-19T08:26:59.454445Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.85707103214825275"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def r2_cv(model):\n",
    "    r2= cross_val_score(model, X, y, scoring=\"explained_variance\", cv = 5)\n",
    "    return r2\n",
    "\n",
    "np.mean(r2_cv(forest))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [conda env:anaconda]",
   "language": "python",
   "name": "conda-env-anaconda-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.4"
  },
  "latex_envs": {
   "LaTeX_envs_menu_present": true,
   "autoclose": false,
   "autocomplete": true,
   "bibliofile": "biblio.bib",
   "cite_by": "apalike",
   "current_citInitial": 1,
   "eqLabelWithNumbers": true,
   "eqNumInitial": 1,
   "hotkeys": {
    "equation": "Ctrl-E",
    "itemize": "Ctrl-I"
   },
   "labels_anchors": false,
   "latex_user_defs": false,
   "report_style_numbering": false,
   "user_envs_cfg": false
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "165px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
